package org.umss.fixturebuilder.scoreboard;

import org.umss.fixturebuilder.model.appengine.GameModel;
import org.umss.fixturebuilder.model.appengine.ResultType;
import org.umss.fixturebuilder.model.appengine.TeamPosition;

/**
 *
 * @author Daniela Meneses
 */
public class ScoreBoardPositionCalculator {

    public static void calculateResults(GameModel game, TeamPosition local, TeamPosition visitor) {
        if (game.getLocalScore() == game.getVisitorScore()) {
            local.setResult(ResultType.DRAW);
            visitor.setResult(ResultType.DRAW);
        } else {
            if (game.getLocalScore() > game.getVisitorScore()) {
                local.setResult(ResultType.WIN);
                visitor.setResult(ResultType.LOST);
            } else {
                local.setResult(ResultType.LOST);
                visitor.setResult(ResultType.WIN);
            }

        }
    }
}
